<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=EseYmMDfdyguuXpSuPrNpXbjRCffDYve"></script>
    <title>地图示例</title>
    <style type="text/css">
        html{height:100%}
        body{height:100%;margin:0px;padding:0px;font-family:"微软雅黑";}
        #container{height:100%;width:100%;}
    </style>
</head>
<body>
<div id="container"></div>
</body>
</html>
<script type="text/javascript">
    // 创建地图实例
    var map = new BMap.Map("container");
    //设置地图的中心点
    var point = new BMap.Point(116.331398,39.897445);
    // 初始化地图，设置中心点坐标和地图级别
    map.centerAndZoom(point, 13);
    // 允许滚轮缩放

    map.enableScrollWheelZoom();
    var geolocation = new BMap.Geolocation();
    // 开启SDK辅助定位
    geolocation.enableSDKLocation();
    geolocation.getCurrentPosition(function(r){
        if(this.getStatus() == BMAP_STATUS_SUCCESS){
            var mk = new BMap.Marker(r.point);
            map.addOverlay(mk);// 将标注添加到地图中
            map.panTo(r.point);
            // alert('您的位置：'+r.point.lng+','+r.point.lat);
        }
        else {
            // alert('failed'+this.getStatus());
        }
    });
</script>
